﻿using Dapper;
using EOrm;
using LeanApp.Model;
using System;

namespace LeanApp.General
{
    /// <summary>
    /// 实体映射
    /// </summary>
    internal class EntityTypeMapper
    {
        /// <summary>
        /// 映射实体
        /// </summary>
        internal static void TypeMap()
        {
            EntityTypeMap<LineBalance>();
        }

        /// <summary>
        /// 实体类型映射
        /// </summary>
        /// <typeparam name="T">映射对应的查询实体</typeparam>
        /// <exception cref="Exception">实体配置缺少对应项目</exception>
        private static void EntityTypeMap<T>()
        {
            SqlMapper.SetTypeMap(typeof(T), new CustomPropertyTypeMap(typeof(T), EOrmEntityMapper.EntityTypeMap));
        }
    }
}
